<template>
  <div>
      <h1>第二个组件</h1>
      <div>
          <h1>基于vuex的数据的computed:{{five}}</h1>
          <h1>state：{{$store.state.count}}</h1>
          <h1>getters:{{$store.getters.countGetter}}</h1>
          <button @click="cgCount">触发mutations</button>
           <button @click="acChange">触发actions</button>
      </div>
  </div>
</template>

<script>
export default {
  name: '2304BAddressTwo',

  data() {
    return {
      
    };
  },

  mounted() {
      console.log(this.$store.getters.countGetter)
  },
  computed:{ //可以用来计算data 和vuex等数据
      five(){
        return this.$store.state.count/5
      }
  },
  methods: {
      cgCount(){
        this.$store.commit("changeCount",10)
      },
      acChange(){
        this.$store.dispatch("actCount",6)
      }
  },
};
</script>